function uuid(){
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function (c) {
        var r =Math.random() * 16 | 0 ,
        v = c == 'x' ? r: (r & 0x3|0x8);
        return v.toString(16);
    })
}
layui.use(['form','layarea'], function () {
    var form = layui.form,
        layer = layui.layer,
        layarea = layui.layarea,
        $ = layui.$;
    layarea.render({
        elem: '#area-picker',

        change: function (res) {
            //选择结果
            // console.log(res);
        }
    });
    //监听提交
    form.on('submit(saveBtn)', function (data) {
        var confirm = layer.confirm("确认添加？", function () {
            // 调用接口/Member/add，添加数据
            data.field.mem_uid = uuid();
            $.ajax({
                url:"/Member/add",
                type:"post",
                data:JSON.stringify([data.field]),
                datatype:"json",
                success:(res)=>{
                    var alert = layer.alert(JSON.stringify(res), {
                        title: '最终的提交信息'
                    }, function () {
                        // 关闭弹出层
                        layer.close(alert);
                        // 关闭弹出层
                        layer.close(confirm);

                        var iframeIndex = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(iframeIndex);
                    });
                }
            })
        });

        return false;
    });

});